﻿

@using DCMS.Web.Extensions;
@using DCMS.Web.Framework.UI;
@using DCMS.ViewModel.Models.Products;

@model SpecificationAttributeListModel


<section id="content_wrapper">

	<!-- Start: Topbar-Dropdown -->
	<div id="topbar-dropmenu">
		@await Html.PartialAsync("_ToolBox")
	</div>
	<!-- End: Topbar-Dropdown -->
	<!-- Start: Topbar -->
	<header id="topbar">
		<div class="topbar-left">
			<ol class="breadcrumb">
				<li class="crumb-active">
					<a href="#">档案</a>
				</li>
				<li class="crumb-icon">
					<a href="@Url.RouteUrl("HomePage")">
						<span class="glyphicon glyphicon-home"></span>
					</a>
				</li>
				<li class="crumb-link">
					<a href="#">商品相关</a>
				</li>
				<li class="crumb-trail">单位档案</li>
			</ol>
		</div>
		<div class="topbar-right">
			<div class="ml15 ib va-m" id="toggle_sidemenu_r">
				<a href="#" class="pl5">
					<i class="fa fa-sign-in fs22 text-primary"></i>
					<span class="badge badge-hero badge-danger">3</span>
				</a>
			</div>
		</div>
	</header>
	<!-- End: Topbar -->
	<!-- Begin: Content -->
	<section id="content" class="formSection">

		<div class="special-alerts">
			<div class="alert alert-danger light alert-dismissable" id="alert-demo-2" style="display: none;">
				<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
				<i class="fa fa-info pr10"></i>
				<strong>您没有被授权此操作!</strong>
			</div>
		</div>

		<div class="row">
			<div class="col-md-12">

				<div class="panel panel-default">
					<div class="panel-heading">  <span class="glyphicon glyphicon-search"></span> 查询条件</div>
					<div class="panel-body p10">
						<form id="formSearch" novalidate="novalidate">
							<div class="row">
								<div class="col-sm-2">
									<input asp-for="SearchKey" class="form-control" placeholder="关键字..." />
								</div>
								<div class="col-sm-10">
									<button id="btn_query" type="submit" class="btn btn-primary btn-block">
										<span class="glyphicon glyphicon-search mr5" aria-hidden="true"></span>查询
									</button>
								</div>
							</div>
						</form>
					</div>
				</div>


				<div class="panel">
					<div class="panel-heading">
						<div class="panel-title">
							<span class="glyphicon glyphicon-tasks"></span> 单位档案列表
						</div>
					</div>
					<div class="panel-body p10">


						<div class="bootstrap-table">
							<div class="fixed-table-toolbar">
								<div class="bs-bars pull-left">
									<div id="toolbar" class="btn-group">
										<button id="btn_add" type="button" class="btn btn-primary btn-sm">
											<span class="glyphicon glyphicon-plus mr5" aria-hidden="true"></span>添加
										</button>
									</div>
								</div>
								<div class="columns columns-right btn-group pull-right">
									<button class="btn btn-default" type="button" id="btn_refresh" name="refresh" aria-label="refresh" title="刷新"><i class="glyphicon glyphicon-refresh icon-refresh"></i></button>
								</div>
							</div>
							<div class="fixed-table-container">
								<div class="fixed-table-body">

									<table class="table table-striped table-bordered table-hover" id="datatable"
										   data-height="700">
										<thead>
											<tr>
												@*<th class="bs-checkbox " style="text-align: center; vertical-align: middle; width: 36px; " data-field="id"><div class="th-inner "><input name="btSelectAll" type="checkbox"></div></th>*@
												<th class="text-center" data-field="Id"><div class="th-inner">序号</div></th>
												@*<th data-field="StoreName"><div class="th-inner">类型(经销商)</div></th>*@
												<th class="text-left" data-field="Name"><div class="th-inner">属性名</div></th>
												<th class="text-center" data-field="DisplayOrder"><div class="th-inner">排序</div></th>
												<th data-field="Operator" data-align="center" class="text-center w200"><div class="th-inner">操作</div></th>
											</tr>
										</thead>
										<tbody>
											@{
												int index = 0;
												foreach (var attributs in Model.SpecificationAttributes)
												{
													<tr>
														@*<td class="bs-checkbox ">
																<input data-index="@index" name="btSelectItem" class="btSelectItem" type="checkbox" value="@attributs.Id">
															</td>*@
														<td class="text-center">@attributs.Id</td>
														@*<td>@attributs.StoreName</td>*@
														<td class="text-left">@attributs.Name</td>
														<td class="text-center">@attributs.DisplayOrder</td>
														<td class="text-center">
															<a class="btn btn-sm btn-primary btn_addgroup" data-id="@attributs.Id" href="@Url.Action("Edit",new { id=attributs.Id })" target="_blank" title="编辑"><i class="glyphicon glyphicon-pencil mr5"></i> 编辑</a>
															<a class="btn btn-sm btn-danger btn_deletespecificationattribute" data-id="@attributs.Id" title="删除"><i class="glyphicon glyphicon-remove mr5"></i> 删除</a>
														</td>
													</tr>
													index++;
												}

											}
										</tbody>
									</table>

								</div>
								<div class="fixed-table-footer" style="display: none;"><table><tbody><tr></tr></tbody></table></div>
							</div>


                            <div class="fixed-table-pagination" style="display: block;">

                                @{
                                    var pager = Html.Pager(Model.PagingFilteringContext).QueryParam("pagenumber");
                                }

                                @if (!pager.IsEmpty())
                                {
                                    <div class="fixed-table-pagination" style="display: block;">
                                        @Html.Raw(pager.ToString())
                                    </div>
                                }

                            </div>

						</div>

						<div class="clearfix"></div>
					</div>
				</div>
			</div>
		</div>


	</section>

	<!-- End: Content -->
</section>



@{ await Html.RenderPartialAsync("_ModalForm", new ViewDataDictionary(ViewData) { { "formId", "UserForm" }, { "showSave", "true" } }); }



@section CurPageScripts
{

<script type="text/javascript">
        jQuery(document).ready(function () {

            "use strict";

            // Init Theme Core
            Core.init();

            // Init Demo JS
            Demo.init();

			//权限提示
			if ($(this).getUrlQueryString("Authorize") == "noAuthorize") {
				$('#alert-demo-2').fadeToggle();
				setTimeout(function () {
					$('#alert-demo-2').fadeToggle();
				}, 3000);
			}

			//全选
			$("input[name='btSelectAll']").click(function () {
				var selectStatus = $(this).is(':checked')
				if (selectStatus) {
					$("input[name='btSelectItem']").each(function (i, n) {
						n.checked = true;
					});
				} else {
					$("input[name='btSelectItem']").each(function (i, n) {
						n.checked = false;
					});
				}
			});

            var $formSection = $(".formSection");
            //添加
            $("#btn_add", $formSection).click(function () {
				//location.href = "@Url.Action("Create")";
                window.open( "@Url.Action("Create")", "_blank");
            });

            //刷新
            $("#btn_refresh", $formSection).click(function ()
            {
                location.href = "@Url.Action("List")";
            });

           //查询
          // $("#btn_query").click(function () {
          //  $("#datatable").bootstrapTable('refresh', { url: "/Rank/RankList?searchStr=" + $("#txt_SearchStr").val() });
          //});

			//删除
			$(".btn_deletespecificationattribute").click(function ()
            {
				var id = $(this).attr("data-id");
                WinMsg.confirm({ message: "确认要删除选择的数据吗？" }).on(function (e) {
                    if (!e) {
                        return;
					}
					location.href = "@Url.Action("Delete")?id=" + id;
                });
                $("#btn_refresh", $formSection).click(function ()
                {
                    location.href = "@Url.Action("List")";
                });
            });


        });
</script>
}